package org.mobilertrain.qsbk;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;

import org.mobilertrain.qsbk.entity.TypeEntity;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.tool);
        setSupportActionBar(toolbar);
        ViewPager pager = (ViewPager) findViewById(R.id.pager);
        List<TypeEntity> list = new ArrayList<>();
        list.add(new TypeEntity("热图","image"));
        list.add(new TypeEntity("文字","text"));
        list.add(new TypeEntity("视频","video"));
        list.add(new TypeEntity("最热","hot"));
        list.add(new TypeEntity("最新","latest"));
        pager.setAdapter(new TypeAdapter(getSupportFragmentManager(),list));
        TabLayout tab = (TabLayout) findViewById(R.id.tab);
        tab.setupWithViewPager(pager);
    }

}
